package com.hsylient.javase.design.pattern.observer.java8;

import com.hsylient.javase.common.enmu.Status;
import lombok.Data;
import lombok.NoArgsConstructor;

public class ObserverPatternInJava8 {

    public static void main(String[] args) {
        NewsPublisher newsPublisher = new NewsPublisher();
        newsPublisher.addObserver(new NewsSubscriber());
        newsPublisher.addObserver(new NewsSubscriber());
        newsPublisher.addObserver(new NewsSubscriber());
        newsPublisher.addObserver(new NewsSubscriber());
        newsPublisher.addObserver(new NewsSubscriber());
        newsPublisher.addObserver(new NewsSubscriber());


        Employee employee = new Employee();
        employee.setAge(11);
        employee.setId(1001L);
        employee.setName("hsylient");
        employee.setStatus(Status.BUSY);
        employee.setSalary(999999999999999999999999.99999999999999);
        newsPublisher.myCustomMethod(employee);

    }

    @Data
    @NoArgsConstructor
    private static class Employee {

        private Long id;

        private String name;

        private Integer age;

        private Double salary;

        private Status status;
    }
}
